#ifndef D3D10_UTILS_WAVES_H
#define D3D10_UTILS_WAVES_H

#include "D3DUtilities.h"

namespace D3D10Utils
{
	struct Vertex;

	class Waves
	{
	public:
		Waves(const unsigned __int32 rows, const unsigned __int32 columns);
		~Waves();

		void init(ID3D10Device * const device, const float cellSpacing, const float deltaTime, 
			const float speed, const float damping);

		void update(const float deltaTime);
		void disturb(const unsigned __int32 iRow, const unsigned __int32 jColumn, const float magnitude);
		void draw();		

	private:
		Vertex* createVertices();
		unsigned __int32* createIndices();
		void initVertexBuffer();
		void initIndexBuffer();

		ID3D10Device *mDevice;
		ID3D10Buffer *mVertexBuffer;
		ID3D10Buffer *mIndexBuffer;

		const unsigned __int32 mNumVertices;
		const unsigned __int32 mNumFaces;

		const unsigned __int32 mRows;
		const unsigned __int32 mColumns;

		D3DXVECTOR3* mPreviousSolution;
		D3DXVECTOR3* mCurrentSolution;
		D3DXVECTOR3* mNormals;

		float mK1;
		float mK2;
		float mK3;
		float mTimeStep;

		float mSpatialStep;
	};
}

#endif // D3D10_UTILS_GRID_H
